package Simulator;

public class Settings {
	private int protocolType; // 0:MSI 1:MESI
	private int cacheType; // 0:direct_mapped 1:2-way_associative
	private int blockNum;
	private int cacheSize;
	private int blockSize;
	private int procNum;
	private int memSize;
	private int cc, cm, bu, fl;

	private final int BIT_ADDRESS = 32;
	
	private int bitTag;
	private int index;
	private int bitOffset;
	
	/**
	 * @param protocolType
	 * @param cacheType
	 * @param cacheSize
	 * @param blockSize
	 * @param procNum
	 * @param memSize
	 * @param cc
	 * @param mc
	 * @param bu
	 * @param fl
	 */
	public Settings(int protocolType, int cacheType, int cacheSize,
			int blockSize, int procNum, int memSize, int cc, int mc, int bu,
			int fl) {
		this.protocolType = protocolType;
		this.cacheType = cacheType;
		this.cacheSize = cacheSize;
		this.blockSize = blockSize;
		this.blockNum = cacheSize / blockSize;
		this.procNum = procNum;
		this.memSize = memSize;
		this.cc = cc;
		this.cm = mc;
		this.bu = bu;
		this.fl = fl;

		this.index = (Integer.toBinaryString((cacheSize / blockSize) - 1))
				.length();
		this.bitOffset = Integer.toBinaryString((blockSize*2)-1).length();
		this.bitTag = BIT_ADDRESS - bitOffset;// - index;

	}

	public int getProtocolType() {
		return protocolType;
	}

	public int getCacheType() {
		return cacheType;
	}

	public int getBlockNum() {
		return blockNum;
	}

	public int getCacheSize() {
		return cacheSize;
	}

	public int getBlockSize() {
		return blockSize;
	}

	public int getProcNum() {
		return procNum;
	}

	public int getMemSize() {
		return memSize;
	}

	public int getCc() {
		return cc;
	}

	public int getCm() {
		return cm;
	}

	public int getBu() {
		return bu;
	}

	public int getFl() {
		return fl;
	}

	public int getBitTag() {
		return bitTag;
	}

	public int getIndex() {
		return index;
	}

	public int getBitOffset() {
		return bitOffset;
	}

	public int getBitAddress() {
		return BIT_ADDRESS;
	}
	
}
